<?php
namespace Topxia\Common;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\Exception\FileException;

class Mp4Toolkit
{

    public  function GetMp4File($file)
    {
        //set_time_limit(0);
         ini_set("display_errors", "On");

error_reporting(E_ALL | E_STRICT);
//$file='D:\www\zhibo\app/data/udisk\courselesson/380/2018307042437-21q7n8.mp4';
  set_time_limit(0);  
ini_set('memory_limit', '1024M'); 
    $filePath=$file;
    $filename=basename($file);
    $fsize=filesize($file); 
    header("Pragma: public");
    header("Expires: 0"); 
    header("Content-Type: video/mp4"); //文件mime类型
    //header("Content-Disposition: attachment; filename=\"".$filename."\";" ); //文件名$filename
    header("Content-Length: ".$fsize);  //文件大小$fsize
    header('Content-Transfer-Encoding: binary');  
  
  $this->ob_clean(); 
    $this->flush(); 
    return $this->readfile( $filePath );  
    }

   

}